<?php
/**
 * ExtTreePanelBase class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftwareB.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */
 
 
class ExtTreePanelBase extends ExtPanel
{
    private $_node_class_types = array('ExtTreeNode');
    private $_loader_class_types = array('ExtTreeLoader');

    public function parseNode(ExtHTMLParserNode $node,
            ExtASTWalker $astwalker)
    {
        parent::parseNode($node,$astwalker);
        $this->parseLoader($node,$astwalker);
        $this->parseRootNode($node,$astwalker);
        $this->parseContextMenus($node,$astwalker);
    }

    protected function parseContextMenus($node, $astwalker)
    {
        $this->parseContextMenu($node, $astwalker, 'containercontextmenu', 'containerContextMenu', 'containercontextmenu');
    }

    private function parseRootNode($node,$astwalker)
    {
        $root = $node->findPropertyByName('root');
        if(!is_null($root))
        {
            $walker = new ExtAstWalker($node,array(),$astwalker->getController());
            $walker->walk($root,$this,$this->_node_class_types);
        }        
    }

    private function parseLoader($node,$astwalker)
    {
        $loader = $node->findPropertyByName('loader');
        if(!is_null($loader))
        {
            $items=parent::parseNodeWidthTag($loader,
                    $astwalker,
                    true,
                    array('asobject'=>true),
                    $this,
                    $this->_loader_class_types);
            $this->setJavaScriptConfig('loader', $items[0]);
            $loader->shiftUp();
        }
    }
}
?>
